package org.execute.tool.扫雷;

import com.alibaba.fastjson.JSON;
import redis.clients.jedis.Jedis;

import java.util.List;

public class Minesweeper {
//    判断根据概率获取确定点击位置
//    判断位置为空的位置
    static Jedis jedis = new Jedis("localhost", 6379);

    public static void main(String[] args) {
//        while (true) {
//            接收雷场
        String s = jedis.get("Minefield");
        List<String> strings = JSON.parseArray(s, String.class);
        System.out.println(s);
        for (int i = 0; i < strings.size(); i++) {
            for (int i1 = 0; i1 < strings.get(i).length(); i1++) {
                System.out.print(strings.get(i).charAt(i1));
                Minefield minefield = new Minefield();
                minefield.row=i;
                minefield.col=i1;
                if (strings.get(i).charAt(i1) == 'H') {
                    minefield.mine = 0;
                }
                if (strings.get(i).charAt(i1) == ' ') {
                    minefield.mine = 2;
                }
                if (strings.get(i).charAt(i1) == ' ') {
                    minefield.mine = 2;
                }
            }
        }
//        }
    }
}
